import Vue from "vue";
import App from "./App.vue";
import "./styles/reset.css";
import "./styles/iconfont.css";
Vue.config.productionTip = false;
import router from "./router/index";
import { Toast } from "vant";
import { Notify } from "vant";
import { Image as VanImage } from "vant";
import { Dialog } from "vant";
import { Rate } from "vant";
import { Icon } from 'vant';
import { NavBar } from 'vant'
import { Uploader } from 'vant';
import { Form } from 'vant';
import { Field } from 'vant';
import { Tab, Tabs } from 'vant';
import { ActionSheet } from 'vant';
import { List } from 'vant';
import { PullRefresh } from 'vant';
import { Button } from 'vant';
import { SwipeCell } from 'vant';
import { Empty } from 'vant';
import { Search } from 'vant';

Vue.use(Search);
Vue.use(Empty);
Vue.use(SwipeCell);
Vue.use(Button);
Vue.use(PullRefresh);
Vue.use(List);
Vue.use(ActionSheet);
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(Form);
Vue.use(Field);
Vue.use(Uploader);
Vue.use(NavBar)
Vue.use(Icon);
Vue.use(Rate);
Vue.use(Toast);
Vue.use(Notify);
Vue.use(VanImage);
Vue.use(Dialog);
import request from "./utils/request"
Vue.filter('imgUrl', (val) => {
  // 如果没有 http 开始，就需要拼接成完整的图片地址
  if (!val) {  // undefined 和 '' 其实都属于假值，取反布尔值都为 true
    // 在JS文件中，本地图片需要导入后，才能使用其打包后的路径
    return 
    // return require('./assets/logo.png')
  } else if (val.indexOf('http') === -1) {
    return request.defaults.baseURL + val
  } else {
    // 是 http 开头，就直接返回即可
    return val
  }
})
Vue.filter('formatDate', (val) => {
  // console.log(val)
  if (val) {
    return val.replace('T', ' ').replace('.000Z', '')
  }
})
new Vue({
  router,
  render: (h) => h(App),
}).$mount("#app");
